package com.ethink.warehouse.converter;

import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
import com.ethink.framework.common.converter.Converter;
import com.ethink.warehouse.api.info.StockInOrderDetailBatchInfo;
import com.ethink.warehouse.common.entity.StockInOrderDetailBatch;

/**
 * 仓库入库单批次信息 Converter转换器
 *
 * @author default
 * @date 2022-12-05
 */
@Component
public class StockInOrderDetailBatchConverter implements Converter<StockInOrderDetailBatchInfo, StockInOrderDetailBatch> {

    @Override
    public StockInOrderDetailBatch convertTo(StockInOrderDetailBatchInfo info) {
        if(info == null) {
            return null;
        }
        StockInOrderDetailBatch entity = new StockInOrderDetailBatch ();
        BeanUtils.copyProperties(info, entity);
        return entity;
    }

    @Override
    public StockInOrderDetailBatchInfo convertFrom(StockInOrderDetailBatch entity) {
        if(entity == null) {
            return null;
        }
        StockInOrderDetailBatchInfo info = new StockInOrderDetailBatchInfo();
        BeanUtils.copyProperties(entity, info);
        return info;
    }
}
